Quantum error correction protects quantum information against environmental noise. When using qubits, a measure of quality of a code is the maximum number of errors that it is able to correct. We show that a suitable notion of ``number of errors'' e makes sense for any system in the presence of arbitrary environmental interactions. In fact, the notion is directly related to the lowest order in time with which uncorrectable errors are introduced, and this in turn is derived from a grading of the algebra generated by the interaction operators. As a result, e-error-correcting codes are effective at protecting quantum information without requiring the usual assumptions of independence and lack of correlation. We prove the existence of large codes for both quantum and classical information. By viewing error-correcting codes as subsystems, we relate codes to irreducible representations of certain operator algebras and show that noiseless subsystems are infinite-distance error-correcting codes. An explicit example involving collective interactions is discussed.